package main

import (
	"fmt"
	"github.com/pebbe/zmq4"
	"log"
	"time"
)

func main() {
	log.SetFlags(log.Lshortfile)
	context, err := zmq4.NewContext()
	if err != nil {
		log.Println(err)
	}
	responder, err := context.NewSocket(zmq4.PUB)
	if err != nil {
		log.Println(err)
	}
	err = responder.Bind("tcp://127.0.0.1:5556")
	if err != nil {
		log.Println(err)
	}
	err = responder.Bind("ipc://weather.ipc")
	if err != nil {
		log.Println(err)
	}
	i := 0
	for {
		_, err = responder.SendMessage(fmt.Sprintf("num %d", i))
		if err != nil {
			log.Println(err)
		}
		time.Sleep(time.Second)
		i++
	}
}
